*------------------------------------------------------------------------------*
* Family history - Dinas, Fouka, Schläpfer - JoP
*------------------------------------------------------------------------------*

*------------------------------------------------------------------------------*
* Table D8-D9
*------------------------------------------------------------------------------*



*------------------------------------------------------------------------------*
* Greece
*------------------------------------------------------------------------------*

use greece, clear

local treatment T
local controls female i.age i.edu i.occupation i.income i.nomos 
estimates clear
foreach x in study_rec_bst permitstay_rec_bst moneygreekneeds_bst threat_bst responsible_bst {
	reg `x' asiaminor##T, cl(municipality)
	eststo m_`x'
	reg `x' asiaminor##T `controls', cl(municipality)
	eststo m_`x'_c
}
esttab m* using "Table_D8.html", star(+ 0.1 * 0.05 ** 0.01 *** 0.001) replace ///
		cells(b(fmt(a2) star) se(fmt(a2) par)) stats(N r2) keep(1.asiaminor 1.T 1.asiaminor#1.T) gaps 
		
gen asia_T=asiaminor*T
gen nonasia_T=(1-asiaminor)*T

foreach x in study_rec_bst permitstay_rec_bst moneygreekneeds_bst threat_bst responsible_bst {
	reg `x' asiaminor nonasia_T asia_T, cl(municipality)
	eststo extg_`x'
	reg `x' asiaminor nonasia_T asia_T  `controls', cl(municipality)
	eststo extg_`x'_c
}

esttab extg_* using "Table_D8_addline.html", star(+ 0.1 * 0.05 ** 0.01 *** 0.001) replace ///
		cells(b(fmt(a2) star) se(fmt(a2) par)) stats(N r2) keep(asia_T) gaps 
		
		
*------------------------------------------------------------------------------*
* Germany
*------------------------------------------------------------------------------*

use germany, clear

local treatment t1
local controls i.sex i.state i.age i.F4 i.F13
estimates clear
foreach x in number_st stm_jobs_st stm_crime_st stm_terror_st stm_money_st {
	reg `x' expellee##t1, cl(GKZ)
	eststo m_`x'
	reg `x' expellee##t1 `controls', cl(GKZ)
	eststo m_`x'_c
}
esttab m* using Table_D9.html, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) replace ///
		cells(b(fmt(a2) star) se(fmt(a2) par)) stats(N r2)  ///
		keep(1.expellee 1.t1 1.expellee#1.t1) gaps 

gen expellee_T=expellee*t1
gen nonexpellee_T=(1-expellee)*t1

foreach x in number_st stm_jobs_st stm_crime_st stm_terror_st stm_money_st {
	reg `x' expellee nonexpellee_T expellee_T, cl(GKZ)
	eststo extd_`x'
	reg `x' expellee nonexpellee_T expellee_T `controls', cl(GKZ)
	eststo extd_`x'_c
}

esttab extd_* using Table_D9_addline.html, star(+ 0.1 * 0.05 ** 0.01 *** 0.001) replace ///
		cells(b(fmt(a2) star) se(fmt(a2) par)) stats(N r2)  ///
		keep(expellee_T) gaps 
